__author__ = "Alexandre Lessard"
__copyright__ = "Copyright 2011, Alexandre Lessard"
__credits__ = ["Alexandre Lessard"]
__license__ = "BSD"
__version__ = "0.0.1"
__maintainer__ = "Alexandre Lessard"
__email__ = "alexandre.lessard.ti@gmail.com"
__status__ = "Prototype"

"""Module that setup all the routes and startup all the
controllers of the application"""

#Import system
from simpleAppsSME import app

@app.route('/')
def init_chome(method = None, contact_id = None):
    """Index route of teh website"""
    import simpleAppsSME.controllers.home as home_ctrl
    return home_ctrl.Home().route(method, contact_id)
    
@app.route('/login', methods=['GET', 'POST'])
def login():
       pass
@app.route('/logout')
def logout():
    pass

@app.route('/contacts')
@app.route('/contacts/<string:method>', methods=['GET', 'POST'])
@app.route('/contacts/<string:method>/<int:contact_id>', methods=['GET', 'POST'])
def init_contacts(method = None, contact_id = None):
    """contacts controller loader function"""
    import simpleAppsSME.controllers.contacts as contacts_ctrl
    return contacts_ctrl.Contacts().route(method, contact_id)
    
@app.route('/products')
@app.route('/products/<string:method>', methods=['GET', 'POST'])
@app.route('/products/<string:method>/<int:contact_id>', methods=['GET', 'POST'])
def init_products(method = None, contact_id = None):
    """products controller loader function"""
    import simpleAppsSME.controllers.products as products_ctrl
    return products_ctrl.Products().route(method, product_id)

